using System;
using NUnit.Framework;
using WatiN.Core;

namespace Roommate.IntegrationTests
{
    public class AdministrationActions
    {
        private IE browser;

        public AdministrationActions(IE browser)
        {
            this.browser = browser;
        }

        public void ResetDatabase()
        {
            browser.GoTo("http://localhost/Administration/ResetDatabase");

            Assert.IsTrue(browser.ContainsText("Database reset successful"));
        }

        public void AddRoom(string roomNumber)
        {
            browser.GoTo("http://localhost/Administration/CreateRoom");

            browser.TextField(x => x.Id == "formData.RoomNumber").TypeText(roomNumber);
            browser.Button(x => x.Id == "btnSubmit").Click();

            //Assert.IsTrue(browser.ContainsText("Room created"));
      
        }

        public void SetSystemTime(DateTime time)
        {
            browser.GoTo("http://localhost/Administration/SetSystemTime");

            browser.TextField(x => x.Id == "timeToSet").TypeText(time.ToString());
            browser.Button(x => x.Id == "btnSubmit").Click();
        }
    }
}